package com.snowfeel.sfmall.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.snowfeel.sfmall.sys.model.SysUserRole;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 角色用户关联表 Mapper 接口
 * </p>
 *
 * @author Jerry
 * @since 2020-11-27
 */
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {

    @Insert("<script> " +
            "   INSERT INTO sys_user_role (user_id, role_id) VALUES" +
            "        <foreach collection=\"list\" separator=\",\" item=\"item\" index=\"index\">" +
            "            (#{item.userId,jdbcType=BIGINT}," +
            "            #{item.roleId,jdbcType=BIGINT})" +
            "        </foreach>" +
            "</script>")
    int saveBatch(@Param("list") List<SysUserRole> userRoleList);

}
